Fix UB in to_string(Error) for unrecognized error codes (#18554) (#18554)#18554
Conversation
🔗 Helpful Links🧪 See artifacts and rendered test results at hud.pytorch.org/pr/pytorch/executorch/18554
Note: Links to docs will display an error until the docs builds have been completed. ✅ You can merge normally! (3 Unrelated Failures)As of commit ef47e08 with merge base 2d13fae ( FLAKY - The following jobs failed but were likely due to flakiness present on trunk:
BROKEN TRUNK - The following job failed but were present on the merge base:👉 Rebase onto the `viable/strict` branch to avoid these failures
This comment was automatically generated by Dr. CI and updates every 15 minutes. |
|
@alexey-sidnev has exported this pull request. If you are a Meta employee, you can view the originating Diff in D97662639. |
This PR needs a
|
Summary: executorch::runtime::to_string(Error) returns const char* via a switch statement with no default case. For unrecognized error codes, the function falls off the end without returning (undefined behavior), which in practice returns nullptr. The fix: 1. Adds a fallback return "Error::Unknown" after the switch in to_string() (without a default: case, preserving -Wswitch coverage for missing enum values). 2. Adds tests for to_string() covering all 21 enum values and the unknown error code path. Differential Revision: D97662639
fd5b53a to
baffc13
Compare
Summary: Pull Request resolved: pytorch#18554 executorch::runtime::to_string(Error) returns const char* via a switch statement with no default case. For unrecognized error codes, the function falls off the end without returning (undefined behavior), which in practice returns nullptr. The fix: 1. Adds a fallback return "Error::Unknown" after the switch in to_string() (without a default: case, preserving -Wswitch coverage for missing enum values). 2. Adds tests for to_string() covering all 21 enum values and the unknown error code path. Differential Revision: D97662639
baffc13 to
eebaa51
Compare
Summary: executorch::runtime::to_string(Error) returns const char* via a switch statement with no default case. For unrecognized error codes, the function falls off the end without returning (undefined behavior), which in practice returns nullptr. The fix: 1. Adds a fallback return "Error::Unknown" after the switch in to_string() (without a default: case, preserving -Wswitch coverage for missing enum values). 2. Adds tests for to_string() covering all 21 enum values and the unknown error code path. Differential Revision: D97662639
eebaa51 to
7d87728
Compare
Summary: Pull Request resolved: pytorch#18554 executorch::runtime::to_string(Error) returns const char* via a switch statement with no default case. For unrecognized error codes, the function falls off the end without returning (undefined behavior), which in practice returns nullptr. The fix: 1. Adds a fallback return "Error::Unknown" after the switch in to_string() (without a default: case, preserving -Wswitch coverage for missing enum values). 2. Adds tests for to_string() covering all 21 enum values and the unknown error code path. Differential Revision: D97662639
7d87728 to
9c41977
Compare
|
@alexey-sidnev has imported this pull request. If you are a Meta employee, you can view this in D97662639. |
|
@pytorchbot merge |
|
Mergebot is not configured for this repository. Please use the merge button provided by GitHub. |
5bb3298 to
0ff8d85
Compare
… (pytorch#18554) Summary: executorch::runtime::to_string(Error) returns const char* via a switch statement with no default case. For unrecognized error codes, the function falls off the end without returning (undefined behavior), which in practice returns nullptr. The fix: 1. Adds a fallback return "Error::Unknown" after the switch in to_string() (without a default: case, preserving -Wswitch coverage for missing enum values). 2. Adds tests for to_string() covering all 21 enum values and the unknown error code path. Reviewed By: JacobSzwejbka Differential Revision: D97662639 Pulled By: alexey-sidnev
… (pytorch#18554) Summary: executorch::runtime::to_string(Error) returns const char* via a switch statement with no default case. For unrecognized error codes, the function falls off the end without returning (undefined behavior), which in practice returns nullptr. The fix: 1. Adds a fallback return "Error::Unknown" after the switch in to_string() (without a default: case, preserving -Wswitch coverage for missing enum values). 2. Adds tests for to_string() covering all 21 enum values and the unknown error code path. Pull Request resolved: pytorch#18554 Reviewed By: JacobSzwejbka Differential Revision: D97662639 Pulled By: alexey-sidnev
0ff8d85 to
f878b3d
Compare
… (pytorch#18554) Summary: executorch::runtime::to_string(Error) returns const char* via a switch statement with no default case. For unrecognized error codes, the function falls off the end without returning (undefined behavior), which in practice returns nullptr. The fix: 1. Adds a fallback return "Error::Unknown" after the switch in to_string() (without a default: case, preserving -Wswitch coverage for missing enum values). 2. Adds tests for to_string() covering all 21 enum values and the unknown error code path. Reviewed By: JacobSzwejbka Differential Revision: D97662639 Pulled By: alexey-sidnev
f878b3d to
c64bd6a
Compare
… (pytorch#18554) Summary: executorch::runtime::to_string(Error) returns const char* via a switch statement with no default case. For unrecognized error codes, the function falls off the end without returning (undefined behavior), which in practice returns nullptr. The fix: 1. Adds a fallback return "Error::Unknown" after the switch in to_string() (without a default: case, preserving -Wswitch coverage for missing enum values). 2. Adds tests for to_string() covering all 21 enum values and the unknown error code path. Pull Request resolved: pytorch#18554 Reviewed By: JacobSzwejbka Differential Revision: D97662639 Pulled By: alexey-sidnev
c64bd6a to
ef47e08
Compare
… (pytorch#18554) Differential Revision: D97662639 Pull Request resolved: pytorch#18554
Summary:
executorch::runtime::to_string(Error) returns const char* via a switch statement with no default case. For unrecognized error codes, the function falls off the end without returning (undefined behavior), which in practice returns nullptr.
The fix:
Reviewed By: JacobSzwejbka
Differential Revision: D97662639
Pulled By: alexey-sidnev